#!/usr/bin/env python

import urllib
import urllib2

# Google App Engine Development Server Port
port = 19000

# URL To invoke as Admin
request = '/cron/validate-libs'

url = 'http://localhost:%d/_ah/login' % (port)

opts = {
    'continue': url,
    'email': 'test@example.com',
    'admin': 'True',
    'action': 'Login'
}

data = urllib.urlencode(opts)

print(url + "?" + data)

try:
    req = urllib2.Request(url, data)
    response = urllib2.urlopen(req)
    print(response.read())
    print("OK")
    
#    req = urllib2.Request(url, data)
except urllib2.URLError, e:
    print("ERROR")
    print(e)
  
#wget -q -O - 'http://localhost:19000/_ah/login?continue=http%3A%2F%2Flocalhost%3A19000%2Fcron%2Fvalidate-libs&email=test%40example.com&admin=True&action=Login'
